// import com->alibaba->druid->FastsqlException;
// import com->alibaba->druid->sql->ast->SQLHint*;
// import com->alibaba->druid->sql->ast->SQLName*;
// import com->alibaba->druid->sql->visitor->SQLASTVisitor;

// import java->io->IOException;
// import java->util->ArrayList;
// import java->util->std::list;
#pragma once
#include <string>
#include <list>
#include <sstream>
#include "SQLTableSourceImpl.h"
#include "SQLUnionQuery.h"

#include "../SQLName.h"
#include "../../../utils/common_ptr.h"

class SQLASTVisitor;
class SQLUnionQueryTableSource : virtual public SQLTableSourceImpl
{
public:
  SQLUnionQuery_ptr xunion;
  SQLName_list_ptr  columns;

  SQLUnionQueryTableSource();
  SQLUnionQueryTableSource(string_ptr  alias);

  SQLUnionQueryTableSource(SQLUnionQuery_ptr xunion, string_ptr  alias);

  SQLUnionQueryTableSource(SQLUnionQuery_ptr xunion);
  SHAREDOBJECT(SQLUnionQueryTableSource);

  void accept0(SQLASTVisitor_ptr visitor)override ;

  void output(std::stringstream *  buf);

  SQLUnionQuery_ptr getUnion();

  void setUnion(SQLUnionQuery_ptr xunion);

  // SQLUnionQueryTableSource *clone();
  virtual SQLObject_ptr clone();

  SQLName_list_ptr  getColumns();

  bool equals(Object_ptr o);

  int hashCode();

  SQLTableSource_ptr findTableSourceWithColumn(long columnNameHash, string_ptr  columnName, int option);
};
